//
//  GSMainNavigationBar.m
//  GameSky
//
//  Created by lanou on 16/1/12.
//  Copyright © 2016年 NiRongfei. All rights reserved.
//

#import "GSMainNavigationBar.h"

#define kMargin 5
#define kButtonW 44
#define kButtonH 44
#define kTitleScrollViewH 44
#define kTitleScrollViewW kScreenWidth - 2 * kMargin - 2 * kButtonW

@implementation GSMainNavigationBar

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        // 夜间模式
        self.dk_backgroundColorPicker = DKColorWithColors(kNavBarColor, [UIColor blackColor]);
        
        self.leftButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        self.leftButton.frame = CGRectMake(kMargin, 20, kButtonW, kButtonH);
        [self.leftButton setImage:[UIImage imageNamed:@"common_Icon_OptionButton_20x20_UIMode_Day@2x"] forState:(UIControlStateNormal)];
        [self.leftButton setImage:[UIImage imageNamed:@"common_Icon_OptionButton_20x20_UIMode_Night"] forState:(UIControlStateHighlighted)];
        [self addSubview:self.leftButton];
        
        self.titleScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(self.leftButton.right + kMargin, 20,kTitleScrollViewW , kTitleScrollViewH)];
        self.titleScrollView.showsHorizontalScrollIndicator = NO;
        self.titleScrollView.showsVerticalScrollIndicator = NO;
        self.titleScrollView.alwaysBounceHorizontal = YES;
        [self addSubview:self.titleScrollView];
        
        self.rightButton = [UIButton buttonWithType:(UIButtonTypeCustom)];
        self.rightButton.frame = CGRectMake(self.titleScrollView.right, 20, kButtonW, kButtonH);
        [self addSubview:self.rightButton];
    }
    return self;
}

@end
